// pages/reward/reward.js
const app = getApp()
var util = require('../../utils/util.js');
var getInfo = util.getInfo;
Page({

  /**
   * 页面的初始数据
   */
  data: {
    infos:null,
    show_toast:false,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let that=this;
    let type=options.type;
    let p={};
    console.log(type);
    if(type==''){
      p = {
        m: 'team_x',
        a: 'reward',
        uid: wx.getStorageSync('uid')
      }
    }
    else{
      p = {
        m: 'team_x',
        a: 'reward',
        type: type,
        uid: wx.getStorageSync('uid')
      }
    }
    
    getInfo(p).then(res=>{
      console.log(res);
      that.setData({
        infos:res.result
      })
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  },
  submitFormId(e) {
    console.log(e);
    let formId = e.detail.formId;
    let that = this;
    let p = {
      m: 'colform',
      uid: wx.getStorageSync('uid'),
      formId: formId
    };
    getInfo(p).then(res => console.log('success'))
  },
  close_toast() {
    let that = this;
    that.setData({
      show_toast: false
    })
  },
  openShare() {
    let that = this;
    that.setData({
      show_toast: true
    })
  },
})